﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Managers
{
    class Manager
    {
        public static CronManager cronM { get; private set; }
        public static BeepManager beepM { get; private set; }
        public static SettingManager settingM { get; private set; }
        public static HotKeyManager hotkeyM { get; private set; }
        public static TTSManager ttsM { get; private set; }
        public static PanelManager panelM { get; private set; }
        public static JargonMapManager jargonM { get; private set; }
        public static ZXGManager zxgM { get; private set; }

        public static Forms.Client clientForm;
        public static Forms.LoginForm loginForm;
        public static Forms.TopUpForm topUpForm;
        public static Forms.SelectKRangeForm selectKRangeForm
        {
            get
            {
                if (_selectKRangeForm == null)
                    _selectKRangeForm = new Forms.SelectKRangeForm();
                return _selectKRangeForm;
            }
        }
        public static Forms.newsForm newsForm
        {
            get
            {
                if (_newsForm == null)
                    _newsForm = new Forms.newsForm();
                return _newsForm;
            }
            set
            {
                _newsForm = value;
            }
        }
        static Forms.SelectKRangeForm _selectKRangeForm = null;
        static Forms.newsForm _newsForm = null;

        public static event Action OnExit;

        public static DataCenter.Models.IInfo hotIndex { get; set; }
        public static DataCenter.Models.StockInfo hotStockInfo
        {
            get { return _hotStockInfo; }
            set
            {
                _hotStockInfo = value;
                hotStockInfoChanged?.Invoke();
            }
        }
        static DataCenter.Models.StockInfo _hotStockInfo = null;
        public static event Action hotStockInfoChanged;

        public static string userPath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\yystock";

        public static bool isCheckUpdate = false;

        public static void InitManager()
        {
            settingM = new SettingManager();
            hotkeyM = new HotKeyManager();
            ttsM = new TTSManager();
            beepM = new BeepManager();
            cronM = new CronManager();
            panelM = new PanelManager();
            jargonM = new JargonMapManager();
            zxgM = new ZXGManager();
        }

        public static void ExitApp()
        {
            OnExit();
            System.Windows.Forms.Application.Exit();
        }
    }
}
